package com.netease.task.service.impl;


import com.netease.task.dao.BookMapper;
import com.netease.task.meta.Book;
import com.netease.task.service.BookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookServiceImpl implements BookService {

    @Autowired
    private BookMapper bookMapper;

    @Override
    public List<Book> getBooks() {
        return bookMapper.getBooks();
    }

    @Override
    public int addBook(Book book) {
        return bookMapper.addBook(book);
    }

    @Override
    public int deleteBook(Integer id) {
        return bookMapper.deleteBook(id);
    }

    @Override
    public Book getBookById(Integer id) {
        return bookMapper.getBookById(id);
    }

    @Override
    public Integer getIdByTitle(String title) {
        return bookMapper.getIdByTitle(title);
    }

    @Override
    public int updateById(Book book) {
        return bookMapper.updateById(book);
    }

    @Override
    public List<Book> getBooksNoSell() {
        return bookMapper.getBooksNoSell();
    }

    @Override
    public List<Book> getBooksSelled() {
        return bookMapper.getBooksSelled();
    }

    @Override
    public int updateIsSell(Integer id) {
        return bookMapper.updateIsSell(id);
    }
}
